package org.nativejpa.samples.firstapp;

import javax.persistence.EntityManager;
import javax.persistence.Persistence;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;
import java.util.Map;
import java.util.HashMap;

/**
 * @author <a href="mailto:jfox.young@gmail.com">Young Yang</a>
 * @create 2009-8-19 14:27:49
 */
public class Main {

    public static void main(String[] args) {
        SampleDAO sampleDAO = new SampleDAO();
        try {
            // create tables, init tables
            sampleDAO.initDatabase();
            // displayer datas
            sampleDAO.showDatabase();

            System.out.println(sampleDAO.getPersonById(1));

            System.out.println(sampleDAO.getPersonByName("PERSON_2"));

            System.out.println(sampleDAO.getPersonsByAddress(3));
        }
        finally {
            sampleDAO.close();
        }
    }
}
